export default function htmlEscape(text: string): string {
  let reg = /[<>"&]/g
  return text.replace(reg, (match: string, ...arg: any[]): string => {
    switch (match) {
      case '<':
        return "&lt;"
      case ">":
        return "&gt;"
      case "&":
        return "&amp;"
      case "\"":
        return "&quot;"
      default:
        return ""
    }
  })
}
